#pragma GCC optimize(2)
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define pi acos(-1.0)
#define e exp(1.0)
typedef pair<ll,ll> pa;
const ll maxn=120;
ll T,N,M;
ll num[maxn];
set<ll>S;
int main()
{
//  freopen(".../.txt","w",stdout);
//  freopen(".../.txt","r",stdin);
	ios::sync_with_stdio(false);
	cin>>T;
	while(T--){
		cin>>N>>M;
		ll i,j;
		for(i=1;i<=N;i++){
			string sb;
			cin>>sb;
			ll sum=0;
			for(j=sb.length()-1;j>=0;j--){
				if(sb[j]=='1')
				sum+=pow(2,sb.length()-1-j);
			}
			num[i]=sum;
		}
		S.clear();
		ll pos=pow(2,M)-1;
		ll ans=(pos>>1);
		pos++;
		for(i=1;i<=N;i++){
			S.insert(num[i]);
			if(pos&1){
				if(num[i]>=ans){
					ans--;
					while(1){
						if(S.find(ans)!=S.end())
						ans--;
						else
						break;
					}
				}
			}
			else{
				if(num[i]<=ans){
					ans++;
					while(1){
						if(S.find(ans)!=S.end())
						ans++;
						else
						break;
					}
				}				
			}
			pos--;
		}
		string s="";
		while(ans){
			if(ans&1)
			s+='1';
			else
			s+='0';
			ans>>=1;
		}
		reverse(s.begin(),s.end());
		if(s.length()!=M){
			for(i=M;i>s.length();i--)
			cout<<"0";
		}
		cout<<s<<endl;
		
	}	
	return 0;
}
